import java.util.*;
public class Test {

    /*
    题目：通配符 ？ 和 *
     */
    public static void main1(String[] args){
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        str1 = str1.toLowerCase();
        str2 = str2.toLowerCase();
        int len1 = str1.length();
        int len2 = str2.length();

        Set<Character> set = new HashSet<>();
        for(int i = 0; i < 26; i++){
            set.add((char)('a' + i));
        }
        for(int i = 0; i < 9; i++){
            set.add((char)('0' + i));
        }

        int j = 0;
        int i = 0;
        for(; i < len1 && j < len2; i++){
            char ch = str1.charAt(i);
            char ch1 = str2.charAt(j);

            if(!set.contains(ch1)){
                System.out.print(false);
                return;
            }

            if(ch >= 'a' && ch <= 'z'){
                if(ch == ch1){
                    j++;
                    continue;
                }else{
                    System.out.print(false);
                    return;
                }
            }else if(ch >= '0' && ch <= '9'){
                if(ch == ch1){
                    j++;
                    continue;
                }else{
                    System.out.print(false);
                    return;
                }
            }else if(ch == '?'){

                j++;
            }else{
                int size1 = len1 - i;
                int size2 = len2 - j;
                if(size1 == size2){
                    j++;
                }else if(size1 < size2){
                    int size = size2 - size1 + 1;
                    while(size > 0){
                        j++;
                        size--;
                    }
                }
            }
        }

        if(i == len1 && j == len2){
            System.out.print(true);
        }else{
            System.out.print(false);
        }
    }

    public static void main2(String[] args) {
        List<String> list = new LinkedList<>();
        list.add("abc");
        list.add("abc");
        System.out.println(list.get(1).contains(list.get(0)));
    }

    public static void main3(String[] args){
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();



        Set<Character> set1 = new HashSet<>();
        Set<Character> set2 = new HashSet<>();

        for(char x : str1.toCharArray()){
            set1.add(x);
        }

        for(char x : str2.toCharArray()){
            set2.add(x);
        }

        List<String> list1 = new LinkedList<>();
        List<String> list2 = new LinkedList<>();

        int left = 0;
        int right = 0;

        while(right < str1.length()){
            char ch = str1.charAt(right);
            if(set2.contains(ch)){
                right++;
            }else{
                if(right != left){
                    list1.add(str1.substring(left,right));
                }

                right++;
                left = right;
            }
        }

        if(right != left){
            list1.add(str1.substring(left,right));
        }

        left = 0;
        right = 0;

        while(right < str2.length()){
            char ch = str2.charAt(right);
            if(set1.contains(ch)){
                right++;
            }else{
                if(right != left){
                    list2.add(str2.substring(left,right));
                }

                right++;
                left = right;
            }
        }
        if(right != left){
            list2.add(str2.substring(left,right));
        }



        int max = 0;
        for(int i = 0; i < list1.size(); i++){
            String strs1 = list1.get(i);
            for(int j = 0; j < list2.size(); j++){
                String strs2 = list2.get(j);
                int num = findCommonPart(strs1, strs2);
                if(num > max){
                    max = num;
                }
            }
        }

        System.out.print(max);
    }

    private static int findCommonPart(String str1, String str2){
        int len1 = str1.length();
        int len2 = str2.length();

        //str1 长串
        //str2 短串
        if(len2 > len1){
            String str = str1;
            str1 =str2;
            str2 = str;
        }

        int count = 0;
        int max = 0;
        int j = 0;
        int i = 0;
        while(i < str2.length()){
            char ch2 = str2.charAt(i);
            char ch1 = str1.charAt(j);
            if(ch1 == ch2){
                while(ch1 == ch2){
                    count++;
                    i++;
                    j++;
                    if(i < str2.length() && j < str1.length()){
                        ch2 = str2.charAt(i);
                        ch1 = str1.charAt(j);
                    }else{
                        if(count > max){
                            max = count;
                        }
                        break;
                    }

                }
            }else{
                if(count > max){
                    max = count;
                }
                count = 0;
                i++;
            }
        }
        return max;
    }

    public static void main4(String[] args){
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();

        int len1 = str1.length();
        int len2 = str2.length();

        //str1 为短串
        //str2 为长串

        if(len1 > len2){
            String str = str1;
            str1 = str2;
            str2 = str;
        }

        int max = 0;
        for(int i = 0; i < str1.length(); i++){
            for(int j = str1.length(); j > i; j--){
                if(str2.contains(str1.substring(i, j))){
                    if(j - i > max){
                        max = j - i;
                    }
                }
            }
        }
        System.out.print(max);
    }

    public static void main5(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] songs = new int[n];
        for(int i = 0; i < n; i++){
            songs[i] = i + 1;
        }
        String str = sc.next();

        int cursor = 0;
        int left = 0;
        int right = n > 3 ? 4 : n;
        right--;
        for(int i = 0; i < str.length(); i++){
            char ch = str.charAt(i);
            if(ch == 'U'){
                cursor--;
            }
            if(ch == 'D'){
                cursor++;
            }

            if(cursor > right && cursor < n){
                left++;
                right++;
            }

            if(cursor < left && cursor >= 0){
                left--;
                right--;
            }

            if(cursor >= n){
                cursor = 0;
                left = 0;
                right = n > 3 ? 4 : n;
                right--;
            }

            if(cursor < 0){
                cursor = n - 1;
                right = n - 1;
                left = n > 4 ? n - 1 - 3 : 0;
            }
        }

        for(int i = left; i <= right; i++){
            System.out.print(songs[i] + " ");
        }
        System.out.println();
        System.out.println(songs[cursor]);
    }

    private static int divisor(int a , int b){
        int k = a % b;
        while(k > 0){
            a = b;
            b = k;
            k = a % b;
        }
        return b;
    }

    public static void main(String[] args) {
        System.out.println(divisor(12,28));
    }


    public static void main6(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int a = sc.nextInt();
            int c = a;
            int[] defenses = new int[n];
            for(int i = 0; i < n; i++){
                defenses[i] = sc.nextInt();
            }

            for(int i = 0; i < n; i++){
                if(defenses[i] > c){
                    int ret = divisor(defenses[i], c);
                }else{
                    c += defenses[i];
                }
            }
            System.out.print(c);
        }

    }
    }



